<?php
include 'myFunction.php';
include 'dbconnect.php';
$type = $_POST["type"];
$price = $_POST['price'];
$cost = $_POST['cost'];
$unit = $_POST['unit'];
$pname = $_POST['pname'];


$pid = getProductID($type);
//echo $pid." ".$type." ".$pname." ".$price." ".$cost." ".$unit;

	$strSQL = "INSERT INTO dk_product VALUES($pid,'$pname',$cost,$price,'$unit',3,0,0)";
	
	//echo $strSQL;
	
	$objQuery = mysql_query($strSQL) or die ("Error Query [".$strSQL."]");
switch ($type)
{
	case 'bed':{
			$w = $_POST['w'];
			$l = $_POST['l'];
			$h = $_POST['h'];
			$ppf = $_POST['ppf'];
			$fabric = $_POST['fabric'];
			$brand = $_POST['brand'];
			$fill = $_POST['fill'];
			
			echo "<br>";
			//echo $w." ".$l." ".$h." ".$ppf." ".$fabric." ".$brand." ".$fill;
			$strSQL = "INSERT INTO dk_productbed VALUES('$pid',$ppf,'$brand','$fabric','$fill',$w,$l,$h)";
			//echo $strSQL;
			$objQuery = mysql_query($strSQL) or die ("Error Query [".$strSQL."]");
			echo "เพิ่มสินค้าสำเร็จ";
			echo "<meta HTTP-EQUIV='refresh' content='3;url=index.php'>";
	}break;
	case 'doll':{
			
	}break;
	case 'etc':{
			
	}break;
	default:{
			
	}
}

?>